package controller;

import dao.ClassDao;
import model.StudentClass;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

@WebServlet(value = "/queryClassAll")
public class QueryClassAllServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ClassDao classAll=new ClassDao();
        ArrayList<StudentClass> classList=classAll.query_all_class();
        System.out.println(classList.size());
        req.setAttribute("classList",classList);
        req.getRequestDispatcher("/classPage.jsp").forward(req,resp);
      //  req.getRequestDispatcher("/classAll.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req, resp);
    }
}
